package cn.gov.pbc.audit.dao;

import java.math.BigDecimal;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import cn.gov.pbc.audit.pojo.Loan;

public interface LoanMapper {
	int deleteByPrimaryKey(Integer id);

	int insert(Loan record);

	int insertSelective(Loan record);

	Loan selectByPrimaryKey(Integer id);

	int updateByPrimaryKeySelective(Loan record);

	int updateByPrimaryKey(Loan record);

	int deleteAll();

	int insertBatch(@Param("loanList") List<Loan> loanList);

	BigDecimal calculateByInstitutionIdClientType(@Param("institutionId") Integer institutionId,
			@Param("clientType") Integer clientType);

	BigDecimal calculateBadLoanByInstitutionIdClientType(@Param("institutionId") Integer institutionId,
			@Param("clientType") Integer clientType);

	List<String> selectAllFirm();
	
	List<String> selectIndividualByInstitutionId(Integer institutionId);
	
	List<String> selectInclusiveFirmByInstitutionId(Integer institutionId);

	BigDecimal calculateByClientNameClientType(@Param("clientName") String clientName,
			@Param("clientType") Integer clientType);
	
	BigDecimal calculateFirmByClientNameInstitutionId(@Param("clientName")String clientName, 
			@Param("institutionId")Integer institutionId);

	List<Loan> selectByClientNameClientType(@Param("clientName") String clientName,
			@Param("clientType") Integer clientType);
	
	List<Loan> selectByClientNameClientTypeInstitutionId(@Param("clientName") String clientName,
			@Param("clientType") Integer clientType,
			@Param("institutionId")Integer institutionId);
	
	int selectClientCountByClientNameExclueInstitutionId(
			@Param("clientName")String clientName,
			@Param("institutionId")Integer institutionId);
	
	List<Loan> selectIndividualByClientIdInstitutionId(@Param("clientId")String clientId, 
			@Param("institutionId")Integer institutionId);
	
	List<Loan> selectFirmByInstitutionId(Integer institutionId);
	
	List<Loan> selectByClientType(Integer clientType);
	
	List<Loan> selectByClientTypeInstitutionId(@Param("clientType")Integer clientType, @Param("institutionId")Integer institutionId);
	
	List<Loan> selectByClientTypeInstitutionRangeInclusive(
			@Param("clientType")Integer clientType, 
			@Param("institutionIdList")List<Integer> institutionIdList,
			@Param("isInclusive")boolean isInclusive);
	
	List<Loan> selectByClientTypeInclusive(@Param("clientType")Integer clientType, @Param("isInclusive")boolean isInclusive);
}